<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateOrderDistanceTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('order_distance', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('order_id')->index()->comment('订单ID');
            $table->string('book_start')->comment('预约起点');
            $table->string('book_end')->comment('预约终点');
            $table->string('book_start_coord')->comment('预约起点经纬度');
            $table->string('book_end_coord')->comment('预约终点经纬度');
            $table->timestamp('book_time')->comment('预约用车时间');
            $table->string('reality_start')->nullable()->comment('实际起点');
            $table->string('reality_end')->nullable()->comment('实际终点');
            $table->string('reality_start_coord')->nullable()->comment('实际起点经纬度');
            $table->string('reality_end_coord')->nullable()->comment('实际终点经纬度');
            $table->timestamp('reality_start_time')->nullable()->comment('实际上车时间');
            $table->timestamp('reality_end_time')->nullable()->comment('实际下车时间');
            $table->json('tail_info')->nullable()->comment('跟踪信息');
            $table->json('details')->nullable()->comment('资费信息');
            $table->json('driver_details')->nullable()->comment('司机资费信息');


        });
        \DB::statement("ALTER TABLE `order_distance` comment '订单路程表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('order_distance');
    }
}
